
#include <evie-systems.h>
#include "touch.h"

/*
** Touch Memory Types:
**
**   1990 .. 0x01 .. Touch ID Only
**   1991 .. 0x02 .. 2048  bits (256 bytes)  secure r/w memory
**   1993 .. 0x06 .. 4096  bits (512 bytes)  r/w memory
**   1994 .. 0x04 .. 4096  bits (512 bytes)  plus real-time clock
**   1996 .. 0x0c .. 65536 bits (8192 bytes) r/w memory
**   1822 .. 0x?? .. 
**
*/
#define TM1990 0x01
#define TM1991 0x02
#define TM1993 0x06
#define TM1994 0x04
#define TM1996 0x0c

void touch_read(uint8 *buffer,uint8 length)
{
   while( length-- )
   {
      *buffer++ = touch_read_byte();
   }
}

void touch_write(uint8 *buffer,uint8 length)
{
   while( length-- )
   {
      touch_write_byte(*buffer);
      buffer++;
   }
}

uint8 touch_compare(uint8 *buffer,uint8 length)
{
   while( length-- )
   {
      if( touch_read_byte() != *buffer )
      {
         #ifdef SHOW_TOUCH
            puts( "verify error" );
         #endif
         return(0);
      }
      buffer++;
   }

   return(1);
}


